

from backend.cews.services.DownloadService import getCSVWriter, queryStockItemList
from rest_framework.decorators import action


class DownloadViewset(GenericViewSet):
    @action(methods=['post'],detail=False,url_name='download_stock_item',url_path='download_stock_item')
    def download_log(self,request):
        writer = getCSVWriter()

        stock_item_list = queryStockItemList()
        mt_lines = [writer.writerow(row) for row in stock_item_list]

        print("mt_lines", mt_lines)